<?php
namespace Swiftx\Bundle\WeChat\System;
use Swiftx\Component\Application\Server;
use Whoops\Handler\PrettyPageHandler;

require 'vendor/autoload.php';

// 注册异常处理
$whoops = new \Whoops\Run;
$whoops->pushHandler(new PrettyPageHandler);
$whoops->register();

// 初始化服务器
$server = new Server();
$server->boot(__DIR__);

// 启动应用对象
$app = new Application($server);
$app->boot();

// 处理HTTP请求
$request = $server->captureRequest();
$response = $app->handle($request);
$app->terminate($request, $response);